<script setup lang="ts">
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { useQuery } from "@/hooks/init";
import { Router } from "@/utils/router";
// import { Toast } from "@/utils/toast";

// import PopupModal from "@/components/popup/modal.vue";

/**
 * 外部跳转直达中转页
 */
onLoad((options) => {
  useQuery<{ type: string }>(options as MiniApp.AppLaunchOption, (query) => {
    if (query.type === "guider_invite_guider_join_order") {
      // 导游宝同业拼单分享落地页
      Router.reLaunch(
        `/package/activity/pages/dypt/detail?${Router.dataToQuery(query)}`
      );
    } else if (query.type === "guider_share_guider_store") {
      // 导游宝分享导游店铺落地页
      Router.reLaunch(`/pages/index/index?${Router.dataToQuery(query)}`);
    } else if (query.type === "guider_certificate_apply") {
      // 导游认证申请
      Router.reLaunch(
        `/package/guider/pages/apply/type?${Router.dataToQuery(query)}`
      );
    } else if (query.type === "guider_detail") {
      // 导游主页
      Router.reLaunch(
        `/package/guider/pages/detail/index?${Router.dataToQuery(query)}`
      );
    }
  });
});

// const popupModal = ref<InstanceType<typeof PopupModal>>();
</script>

<template>
  <view></view>
  <!-- <PopupModal ref="popupModal" /> -->
</template>
